﻿<UserControl x:Class="Notoric.View.Music.CWNotation.Controls.DynamicMark"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:cvr="clr-namespace:Notoric.View.Music.CWNotation.Converters"
             xmlns:me="clr-namespace:Notoric.View.Music.CWNotation.Controls"
             >
    <UserControl.Resources>
        <cvr:DynamicMarkConverter x:Key="MarkConverter"/>
    </UserControl.Resources>
    <Canvas>
        <me:PositionableDragThumb Canvas.Top="{Binding Position.Y, Mode=OneWay}" Canvas.Left="{Binding Position.X, Mode=OneWay}" Cursor="Hand">
            <me:PositionableDragThumb.Template>
                <ControlTemplate TargetType="{x:Type me:PositionableDragThumb}">
                    <StackPanel Orientation="Horizontal">
                        <TextBlock x:Name="PART_Expression" FontFamily="Georgia" FontStyle="Italic" FontSize="10" Text="{Binding Expression, Mode=OneWay}"/>
                        <TextBlock x:Name="PART_MarkText" FontFamily="MusicalSymbols" FontSize="18" Margin="0 -15 0 0" Text="{Binding Text, Mode=OneWay, Converter={StaticResource MarkConverter}}"/>
                    </StackPanel>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="PART_Expression" Property="Foreground" Value="Blue"/>
                            <Setter TargetName="PART_MarkText" Property="Foreground" Value="Blue"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </me:PositionableDragThumb.Template>
            <me:PositionableDragThumb.ContextMenu>
                <ContextMenu>
                    <MenuItem x:Name="menu_PianoPianissimo" Header="Piano Pianissimo" Click="menu_MarkType_Click"/>
                    <MenuItem x:Name="menu_Pianissimo" Header="Pianissimo" Click="menu_MarkType_Click"/>
                    <MenuItem x:Name="menu_Piano" Header="Piano" Click="menu_MarkType_Click"/>
                    <MenuItem x:Name="menu_MezzoPiano" Header="Mezzopiano" Click="menu_MarkType_Click"/>
                    <MenuItem x:Name="menu_MezzoForte" Header="Mezzoforte" Click="menu_MarkType_Click"/>
                    <MenuItem x:Name="menu_Forte" Header="Forte" Click="menu_MarkType_Click"/>
                    <MenuItem x:Name="menu_Fortissimo" Header="Fortissimo" Click="menu_MarkType_Click"/>
                    <MenuItem x:Name="menu_ForteFortissimo" Header="Forte Fortissimo" Click="menu_MarkType_Click"/>
                    <Separator/>
                    <MenuItem x:Name="menu_IsSubito" Header="Subito" IsCheckable="True" IsChecked="{Binding IsSubito, Mode=OneWay}" 
                              Checked="menu_IsSubito_Checked" Unchecked="menu_IsSubito_Unchecked" />
                    <Separator/>
                    <MenuItem Header="Expression">
                        <MenuItem x:Name="menu_Meno" Header="meno" FontFamily="Georgia" FontStyle="Italic" FontSize="12" Click="menu_Expression_Click" Tag="meno"/>
                        <MenuItem x:Name="menu_Poco" Header="poco" FontFamily="Georgia" FontStyle="Italic" FontSize="12" Click="menu_Expression_Click" Tag="poco"/>
                        <MenuItem x:Name="menu_Piu" Header="più" FontFamily="Georgia" FontStyle="Italic" FontSize="12" Click="menu_Expression_Click" Tag="più"/>
                        <MenuItem x:Name="menu_Molto" Header="molto" FontFamily="Georgia" FontStyle="Italic" FontSize="12" Click="menu_Expression_Click" Tag="molto"/>
                        <MenuItem x:Name="menu_Sempre" Header="sempre" FontFamily="Georgia" FontStyle="Italic" FontSize="12" Click="menu_Expression_Click" Tag="sempre"/>
                        <MenuItem x:Name="menu_Senza" Header="senza" FontFamily="Georgia" FontStyle="Italic" FontSize="12" Click="menu_Expression_Click" Tag="senza"/>
                        <Separator/>
                        <MenuItem x:Name="menu_ClearExpression" Header="Clear Expression" Click="menu_ClearExpression_Click"/>
                    </MenuItem>
                </ContextMenu>
            </me:PositionableDragThumb.ContextMenu>
        </me:PositionableDragThumb>
    </Canvas>
</UserControl>
